import { BaseDetailPenel } from "./BaseDetailPenel";
import { ObjCreate } from "../../common/ObjCreate";
import { Language } from "../../../../../extend/language/Language";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { ImagesConst } from "../../../resource/ImagesConst";
import { BaseItem } from "../../common/BaseItem";
import { SGuildStructureInfo } from "../../../../../Message/Game/SGuildStructureInfo";
import { GameDefConfig } from "../../../resource/GameDefConfig";
import { LoaderManager } from "../../../../../com/gengine/resource/LoaderManager";
import { BuildingImage } from "./BuildingImage";
import { ImageInfo } from "../../../../../com/gengine/resource/info/ImageInfo";
type int = number;
//class CashboxDetailPanel
    
    export  class CashboxDetailPanel extends BaseDetailPenel
    {
        constructor()
        {
            super();
            this.init();
            createCommon();
            return;
        }

        /* internal  */init(): void
        {
            ObjCreate.createBg(0, 0, 505, 100, this);
            ObjCreate.createBg(0, 105, 505, 275, this);
            this._baseSprite = new Object /* flash.display.Sprite */();
            this.addChild(this._baseSprite);
            this._nameText = ObjCreate.createTextField(Language.getString(57060), 30, 5, 220, 20, this._baseSprite, GlobalStyle.textFormat2);
            statusText = ObjCreate.createTextField("", 85, 5, 220, 20, this._baseSprite, GlobalStyle.textFormat5);
            ObjCreate.createTextField(Language.getString(57061), 30, 30, 220, 20, this._baseSprite);
            this._levelText = ObjCreate.createTextField("", 95, 30, 220, 20, this._baseSprite, GlobalStyle.textFormat2);
            ObjCreate.createTextField(Language.getString(57062), 30, 60, 220, 20, this._baseSprite);
            this._levelLimitText = ObjCreate.createTextField("", 95, 60, 220, 20, this._baseSprite, GlobalStyle.textFormat2);
            ObjCreate.createTextField(Language.getString(57063), 170, 30, 220, 20, this._baseSprite);
            this._descText = ObjCreate.createTextField("", 192, 47, 240, 40, this._baseSprite);
            this._descText.wordWrap = true;
            this._descText.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._upgradeSprite = new Object /* flash.display.Sprite */();
            this._upgradeSprite.x = 70;
            this._upgradeSprite.y = 105;
            this.addChild(this._upgradeSprite);
            ObjCreate.createTextField(Language.getString(57064), 160, 5, 220, 20, this._upgradeSprite, GlobalStyle.textFormat2);
            ObjCreate.createBg(15, 30, 68, 70, this._upgradeSprite, ImagesConst.itemBigBg);
            this._buildItem = new BaseItem();
            this._buildItem.width = 62;
            this._buildItem.height = 62;
            this._buildItem.x = 19;
            this._buildItem.y = 33;
            this._upgradeSprite.addChild(this._buildItem);
            ObjCreate.createTextField(Language.getString(57065), 95, 30, 220, 20, this._upgradeSprite);
            this._effectText = ObjCreate.createTextField("", 120, 50, 220, 20, this._upgradeSprite);
            ObjCreate.createTextField(Language.getString(57066), 95, 70, 220, 20, this._upgradeSprite);
            consumeTxt = ObjCreate.createGTextField(Language.getString(57067), 120, 90, 220, 20, this._upgradeSprite);
            fundsInput = ObjCreate.createGTextInput(180, 87, 60, 20, this._upgradeSprite);
            fundsInput.setStyle("textFormat", GlobalStyle.textFormat6);
            fundsInput.editable = false;
            this._upNameText = ObjCreate.createTextField("", 15, 100, 65, 20, this._upgradeSprite);
            this._upNameText.autoSize = flash.text.TextFieldAutoSize.CENTER;
            upgradeBtn = ObjCreate.createGButton(Language.getString(57068), 185, 150, 65, 28, this._upgradeSprite);
            return;
        }

        public updateBuildInfoPanel(arg1: SGuildStructureInfo): void
        {
            var structureInfo: SGuildStructureInfo;
            var type: int;

            var loc1;
            type = 0;
            structureInfo = arg1;
            this.structureInfo = structureInfo;
            if (structureInfo) 
            {
                type = structureInfo.type.__value;
                this._levelLimitText.text = maxLevel.toString();
                this._nameText.text = GameDefConfig.instance.getGuildBuildingName(type);
                this._upNameText.text = this._nameText.text;
                this._levelText.text = structureInfo.level.toString();
                this._descText.htmlText = "<textFormat leading=\'5\'>" + GameDefConfig.instance.getGuildBuildingDesc(type) + "</textFormat>";
                this._effectText.htmlText = GameDefConfig.instance.getGuildBuildingUpgradeDesc(type);
                LoaderManager.instance.load(BuildingImage.getImageName(type), (arg1: ImageInfo): void
                {
                    _buildItem.source = arg1.bitmapData;
                    return;
                })
                runPublic();
            }
            return;
        }

        /* internal */ /* var */_baseSprite: Object /* flash.display.Sprite */;

        /* internal */ /* var */_upgradeSprite: Object /* flash.display.Sprite */;

        /* internal */ /* var */_nameText: Object /* flash.text.TextField */;

        /* internal */ /* var */_levelText: Object /* flash.text.TextField */;

        /* internal */ /* var */_levelLimitText: Object /* flash.text.TextField */;

        /* internal */ /* var */_descText: Object /* flash.text.TextField */;

        /* internal */ /* var */_effectText: Object /* flash.text.TextField */;

        /* internal */ /* var */_upNameText: Object /* flash.text.TextField */;

        /* internal */ /* var */_buildItem: BaseItem;
    }
